package org.example.seata.bs.api.feign.product.factory;

import org.example.seata.bs.api.feign.product.RemoteProductService;
import org.example.seata.bs.api.feign.product.fallback.RemoteProductServiceFallbackImpl;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author hzq
 * @date 2021/11/18 14:46
 */
@Component
public class RemoteProductServiceFallbackFactory implements FallbackFactory<RemoteProductService> {

    @Override
    public RemoteProductService create(Throwable cause) {
        RemoteProductServiceFallbackImpl fallback = new RemoteProductServiceFallbackImpl();
        fallback.setCause(cause);
        return fallback;
    }
}
